# coding:utf-8
# @Time    : 2025/2/8 11:29
# @Author  : liujingmao
# @FileName: ds-infer.py


from openai import OpenAI

deepseek_key = "sk-420b9ef2cfcb489f918942371e4aeb47"
#https://api.deepseek.com/v1
client = OpenAI(api_key=deepseek_key, base_url="https://api.deepseek.com/v1")

# Round 1
messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}]
response = client.chat.completions.create(
    model="deepseek-reasoner",
    messages=messages
)

reasoning_content = response.choices[0].message.reasoning_content
content = response.choices[0].message.content

# Round 2
messages.append({'role': 'assistant', 'content': content})
messages.append({'role': 'user', 'content': "How many Rs are there in the word 'strawberry'?"})
response = client.chat.completions.create(
    model="deepseek-reasoner",
    messages=messages
)
# ...
